package com.ruoyi.web.core.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerInterceptor;

/**
 * @BelongsProject: RuoYi-Vue-master
 * @BelongsPackage: com.ruoyi.web.core.config
 * @Author: chenjiajun
 * @CreateTime: 2023-12-19  14:59
 * @Description: TODO
 * @Email: chenjiajun56@foxmail.com
 * @Version: 1.0
 */
@Configuration
@MapperScan("com.ruoyi.*.mapper")
public class MybatisConfig implements HandlerInterceptor {
    /**
     * 配置mybatis-plus分页插件
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
